package pyip.lib.mixtool.util;


public class BytesKey implements Comparable<BytesKey> 
{
	private final byte[] array;
	private final int hashCode;
	public BytesKey(byte[] array) {
		super();
		this.array = array;
		this.hashCode = BytesUtil.hashCode(array);
	}

	
	public int compareTo(BytesKey o) {
		return BytesUtil.compare(array, o.array);
	}
	
	
	@Override
	public int hashCode() {
		return this.hashCode;
	}


	@Override
	public boolean equals(Object obj) {
		return BytesUtil.equals(array, ((BytesKey)obj).array);
	}


	@Override
	public String toString() {
		return BytesUtil.toHexString(array);
	}
}
